var Action = require("../apiaction");
var Utility = require("../Utility/utility.js");
exports.menuAPI = function(router){

    //获取菜单列表
    router.all('/menu/getmenulist',function(req,res){

        var params ={};
        params = Utility.get_list_page_size_param(req,params);

        Action.send(req, res,"/menu/getmenulist",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //新增菜单
    router.all('/menu/addmenu',function(req,res){

        var params ={menu_name:req.param("menu_name"),url:req.param("url"),parent_id:req.param("parent_id"),};
        params = Utility.get_list_page_size_param(req,params);

        Action.send(req, res,"/menu/addmenu",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //删除菜单
    router.all('/menu/deletemenu',function(req,res){

        var params ={menu_id:req.param("menu_id")};
        params = Utility.get_list_page_size_param(req,params);

        Action.send(req, res,"/menu/deletemenu",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //修改菜单
    router.all('/menu/updatemenu',function(req,res){

        var params ={menu_id:req.param("menu_id"),menu_name:req.param("menu_name"),url:req.param("url"),};
        params = Utility.get_list_page_size_param(req,params);

        Action.send(req, res,"/menu/updatemenu",params,function(res,data) {
            res.status(200).json(JSON.parse(data));
        });
    });




}
